<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue3案例1</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div class="app">
        <div id="counter">
            <h2>{{message}}</h2>
            <p>{{count}}</p>
            <span v-bind:title="time"></span>
            <button v-on:click="reverseMessage">反转</button>
            <input type="text" v-model="content">
            <p>{{content}}</p>
        </div>
    </div>

    <script>
        const Counter = {
            data() {
                return {
                    message: 'helloworld vue3',
                    count: 0,
                    time: 'You loaded this page on ' + new Date().toLocaleString(),
                    content: ''

                }
            },
            methods: {
                reverseMessage() {
                    this.message = this.message.split('').reverse().join('')
                }
            },
            mounted() {
                setInterval(() => {
                    this.count++
                }, 1000);
            }
        }
        Vue.createApp(Counter).mount('#counter')

    </script>
</body>

</html>